<?php

include_once 'CodeObject.php';

class TypeReference extends CodeObject
{
    public function __construct($name)
    {
        parent::__construct();
        $this->set_name($name);
        
    }
    
    public function get_name()
    {
        return $this->name;
    }

    public function set_name($name)
    {
        if(is_string($name))
        {
            $this->name = $name;
        }
        else
        {
            throw new InvalidArgumentException(
            'The value must be a string.');
        }
    }

    public function get_isClass()
    {
        return $this->isClass;
    }

    public function set_isClass($isClass)
    {
        if(is_bool($isClass))
        {
            $this->isClass = $isClass;
            $this->isInterface = !$isClass;
        }
        else
        {
            throw new InvalidArgumentException(
            'The value must be boolean.');
        }
    }

    public function get_isInterface()
    {
        return $this->isInterface;
    }

    public function set_isInterface($isInterface)
    {
        if(is_bool($isInterface))
        {
            $this->isInterface = $isInterface;
            $this->isClass = !$isInterface;
        }
        else
        {
            throw new InvalidArgumentException(
            'The value must be boolean');
        }
    }
    
    private $name;
    private $isClass = true;
    private $isInterface = false;

}

?>
